Skip to content

fix(id): tie serve-lock liveness to the process incarnation (#3040) - #8637

Closed
dezren39 wants to merge 1 commit into
mainfrom
queue/5649-3040-serve-lock
Closed

dezren39 wants to merge 1 commit into
mainfrom
queue/5649-3040-serve-lock

Conversation

@dezren39

@dezren39 dezren39 commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Fixes #3040. Supersedes draft PR #4090 (same approach, ported onto current main — the draft's base predates the #2384 EPERM probe and the #2142 sentinel-PID validation in the same function, and no longer merges).

Change (pkgs/id/src/commands/serve.rs)

Tests (cargo test --lib commands::serve in pkgs/id)

  • New test_is_process_alive_reused_pid: a live process whose recorded start time is off by one tick reads as stale; the exact start time reads as alive (Linux).
  • Existing liveness tests updated to the two-argument form and passing: current process, PID 0, out-of-i32-range PIDs, nonexistent PID, PID 1 (EPERM).

🤖 queue worker lane any-b, task 5649 (adopting the #4090 approach with its author's design intact)


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

The serve lock recorded only a PID and get_serve_info tested PID
existence, so a PID reused by an unrelated process made a dead serve
look alive and wedged discovery on its endpoint. ServeInfo now also
records the serve process start time (Linux /proc/<pid>/stat field
22) at lock creation; is_process_alive compares it when both sides
have one and reports stale on mismatch. Locks written before this
field, and platforms without a readable start time, fall back to the
existing existence probe (kill(pid,0), EPERM counts as alive, sentinel
PIDs refused) unchanged. Ports draft PR #4090 onto current main.
Tests: cargo test test_is_process_alive — 6/6, including a new
reused-PID regression (off-by-one start time reads stale).
@dezren39
dezren39 requested a review from a team as a code owner November 11, 2026 10:12
@coderabbitai

coderabbitai Bot commented Nov 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7b90cc6-ff6a-40b7-b361-46e2c2d09acc
Commits

Reviewing files that changed from the base of the PR and between 3ac887d and 2c6ff3e.

Files selected for processing: 1

  • pkgs/id/src/commands/serve.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T10:14:52.668775Z 2c6ff3e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39

Copy link
Copy Markdown
Member Author

agent-note:v1
state: closed-superseded
task: 17217
lane: code-a
worker: repo-worker-code
What: Closing PR #8637 as superseded by merged PR #8667 (merged 2026-11-11T12:18:32Z, merge commit 761fdc7, fix commit ce1874b).
Evidence (fresh reads this shift, task 17217):

@dezren39 dezren39 closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(serve): serve-lock staleness check tests pid existence, not serve identity — a reused pid wedges serve discovery on a dead endpoint

1 participant